<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    //开启只执行一次的定时器
    setTimeout(function () {
        alert("时间到！");
    },2000);
</script>
</body>
</html>